package com.cjst.service.impl.sys;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import com.cjst.pojo.sys.SysRole;
import com.cjst.sdp.util.ZTreeNode;
import com.cjst.service.impl.base.BaseServiceImpl;
import com.cjst.service.sys.SysRoleService;
import com.cjst.util.CloneClass;

/**
 * 角色 服务层
 * @author yj
 *
 */
@Service
public class SysRoleServiceImpl extends BaseServiceImpl<SysRole, String>  implements SysRoleService{
	
	
	@Override
	public List<ZTreeNode> tree(){
		List<SysRole> roleList=this.list(null);
		List<ZTreeNode> nodeList=new ArrayList<ZTreeNode>();
		if(roleList!=null && roleList.size()>0){
			for (SysRole role : roleList) {
				ZTreeNode node=new ZTreeNode();
				CloneClass.getClone(role, node);
				node.setId(role.getId());
				node.setpId(String.valueOf(role.getPid()));
				node.setName(role.getName());
				nodeList.add(node);
			}
		}
		return nodeList;
	}

	
}
